//************************************************************************
// pp57.java   Author: 20172330
//
// 石头剪刀布。
//************************************************************************

import java.util.Scanner;
import java.util.Random;

public class pp57
{
       public static void main(String[] args)
       {
           String Play = "y";
           int a = 0, b = 0, c = 0;
           Scanner scan = new Scanner(System.in);
	   System.out.println(Play);
           while (Play.equalsIgnoreCase("y"))
           {
            System.out.println("Enter your choise：\nshi tou is 0\njian dao is 1\nbu is 2");
            int user    =    scan.nextInt();
            Random xx    =    new Random();    
            int number    =    xx.nextInt(3);    
            //比较
               if(user==0 && number==0){
                    System.out.println("you choose shi tou，computer is shi tou，Nobody win.");
                    c++;
               }
               else
               if(user==1 && number==0){
                    System.out.println("you choose jian dao，computer is shi tou，you fail");
                    b++;c++;
               }
               else
               if(user==2 && number==0){
                    System.out.println("you choose bu, computer is shi tou, you win");
                    a++;c++;
               }
               else
               if(user==0 && number==1){
                    System.out.println("you choose shi tou, computer is jian dao, you win.");
                    a++;c++;
               }
               else
               if(user==1 && number==1){
                    System.out.println("you choose shi tou，computer is shi tou，Nobody win");
                    c++;
               }
               else 
               if(user==2 && number==1){
                    System.out.println("you choose bu，computer is jian dao,you fail.");
                    b++;c++;
               }
               else
               if(user==0 && number==2){
                    System.out.println("you choose shi tou，computer is bu，you fail.");
                    b++;c++;
               }
               else
               if(user==1 && number==2){
                    System.out.println("you choose jian dao，computer is bu，you win");
                    a++;c++;
               }
               else{
                    System.out.println("you choose bu，computer is bu，Nobody win");
                    c++;
               }
              
            System.out.println("But also to play?(y/n)");
            Play = scan.nextLine();
	    Play = scan.nextLine();
            System.out.println("you win" + a +"ju \n Computer win" + b + "ju \n All" + c + "ju");
           }
       }
}
